class Solution {
    public int averageValue(int[] nums) {
        int num = 0;//记录能被3整除的元素的个数
        int sum = 0;//计算数字的和
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] % 3 == 0 && nums[i] % 2 == 0) {
                num++;
                sum += nums[i];
            }
        }
        int average = 0;
        if (num != 0) {
            switch (sum % 3) {
                case 1:
                case 2:
                case 0:
                    average = sum / num;

            }
            return average;
        }
        else{
                return 0;
        }
    }
}